package com.py.demo;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class test {
    public static void  main(String[] args) {

        System.out.println(toGoatLatin("I speak Goat Latin"));
        
    }

    public static String toGoatLatin(String sentence) {
        String[] sourceStr = sentence.split(" ");
        String result = "";
        String aNum = "";
        for (int i =0;i<sourceStr.length;i++){
            char[] target = sourceStr[i].toCharArray();
            aNum = aNum + "a";
            if (target[0]=='a'||target[0]=='e'||target[0]=='i'||target[0]=='o'||target[0]=='u'||target[0]=='A'||target[0]=='E'||target[0]=='I'||target[0]=='O'||target[0]=='U')
                result = result + sourceStr[i] + "ma" + aNum + " ";
            else
                result = result + sourceStr[i].substring(1,sourceStr[i].length()) + target[0] +"ma" +aNum +" ";
        }
        return result.substring(0,result.length()-1);
    }

    public static String judgement(String sourceStr){
        char[] target = sourceStr.toCharArray();
        if (target[0]=='a'||target[0]=='e'||target[0]=='i'||target[0]=='o'||target[0]=='u'||target[0]=='A'||target[0]=='E'||target[0]=='I'||target[0]=='O'||target[0]=='U')
            return sourceStr + "ma";
        else
            return sourceStr;
    }

}
